package com.yc.sole.erp.request;

import com.yc.sole.framework.validate.SaveGroup;
import com.yc.sole.framework.validate.UpdateGroup;
import jakarta.validation.Valid;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import java.io.Serializable;
import java.util.List;

/**
 * @author yizuomin
 * @date 2024/3/18 21:38
 **/
@Data
public class OutputBatchReq implements Serializable {

    /**
     * 班组id
     */
    @NotNull(groups = {SaveGroup.class, UpdateGroup.class})
    private Long shiftId;
    /**
     * 生产日期
     */
    @Length(max = 10, groups = {SaveGroup.class, UpdateGroup.class})
    @NotBlank(groups = {SaveGroup.class, UpdateGroup.class})
    private String outputDate;
    /**
     * 详情
     */
    @Valid
    @NotEmpty(groups = {SaveGroup.class, UpdateGroup.class})
    private List<OutputBatchDetailReq> dataList;

    @Data
    public static class OutputBatchDetailReq implements Serializable {
        /**
         * 排产编号
         */
        @NotNull(groups = {SaveGroup.class, UpdateGroup.class})
        private String produceNo;
        /**
         * 生产数量
         */
        @Min(value = 1, groups = {SaveGroup.class, UpdateGroup.class})
        @NotNull(groups = {SaveGroup.class, UpdateGroup.class})
        private Integer quantity;
    }
}
